CSharpTest.Net
Run(String[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Processes Namespace > ScriptRunner Class > Run Method : Run(String[]) Method

args

Glossary Item Box

Runs the process and returns the exit code.

Syntax

Visual Basic (Declaration) 
Public Overloads Function Run( _
   ByVal ParamArray args() As String _
) As Integer
C# 
public int Run( 
   params string[] args
)

Parameters

args

Example

Library/Library.Test/TestScriptRunner.cs

C#Copy Code
using (ScriptRunner runner = new ScriptRunner(ScriptEngine.Language.Exe, @"cmd.exe"))
{
    StringWriter sw = new StringWriter();
    runner.OutputReceived += delegate(object o, ProcessOutputEventArgs e) { sw.WriteLine(e.Data); };
    Assert.AreEqual(0, runner.Run("/c", "@echo From EXE"));
    Assert.AreEqual("From EXE", sw.ToString().Trim());
}
VB.NETCopy Code
Using runner As New ScriptRunner(ScriptEngine.Language.Exe, "cmd.exe")
    Dim sw As New StringWriter()
    runner.OutputReceived += Function(o As Object, e As ProcessOutputEventArgs) Do
        sw.WriteLine(e.Data)
    End Function
    Assert.AreEqual(0, runner.Run("/c", "@echo From EXE"))
    Assert.AreEqual("From EXE", sw.ToString().Trim())
End Using

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys